<html>
<head>
<title>graphviz build notes</title>
</head>
<body bgcolor=#ffffff>
<h1>graphviz build notes</h1>
<h2>External packages</h2>
The full build requires external libraries that you must
obtain elsewhere.  Most, if not all of these are optional,
and configure will build graphviz with reduced functionality
if an external library is not found.  Newer versions of these
libraries should be fine - if not, please let us know.
<ul>
<li>GD (generic raster graphics driver for PNG, GIF, JPEG)
<a href="http://www.boutell.com/gd/http/gd-2.0.28.tar.gz">
http://www.boutell.com/gd/http/gd-2.0.28.tar.gz</a>
<br>Graphviz also contains a copy of GD 2.0.4, but we will
remove it eventually so the external library is preferred.
<li>ZLIB (raster image compression)
<a href="http://www.zlib.net/zlib-1.2.3.tar.gz">
http://www.zlib.net/zlib-1.2.3.tar.gz</a>
<br>
NB: Use "./configure -s" to build shared libraries. (See notes in zlib-1.2.3/Makefile)
<li>FREETYPE (renders text in raster graphics formats)
<a href="http://prdownloads.sourceforge.net/freetype/freetype-2.1.3.tar.gz">
http://prdownloads.sourceforge.net/freetype/freetype-2.1.3.tar.gz</a>
<li>PNG (driver for Portable Network Graphics raster format)
<a href="http://prdownloads.sourceforge.net/libpng/libpng-1.2.5.tar.gz">
http://prdownloads.sourceforge.net/libpng/libpng-1.2.5.tar.gz</a>
<li>JPEG (a popular raster format with lossy compression, not critical here)
<a href="ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz">
ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz</a>
<li>EXPAT (XML parser)
<a href="http://prdownloads.sourceforge.net/expat/expat-1.95.5.tar.gz">
http://prdownloads.sourceforge.net/expat/expat-1.95.5.tar.gz</a>
<li>GETTEXT (gcc compatibility library)
<a href="http://ftp.gnu.org/gnu/gettext/gettext-0.11.5.tar.gz">
http://ftp.gnu.org/gnu/gettext/gettext-0.11.5.tar.gz</a>
<li>ICONV (string converstion for text internationalization)
(Many systems already provide iconv in glibc.  Check to see if you already
have a working /usr/bin/iconv before installing this extra package.)
<br>
<a href="http://ftp.gnu.org/gnu/libiconv/libiconv-1.8.tar.gz">
http://ftp.gnu.org/gnu/libiconv/libiconv-1.8.tar.gz</a>
<li>TCL (a command interpreter for the tcldot GUI)
<a href="http://prdownloads.sourceforge.net/tcl/tcl8.3.5-src.tar.gz">
http://prdownloads.sourceforge.net/tcl/tcl8.3.5-src.tar.gz</a>
<li>LIBTOOL (generic library support)
<a href="ftp://ftp.gnu.org/pub/gnu/libtool/libtool-1.5.22.tar.gz">
ftp://ftp.gnu.org/pub/gnu/libtool/libtool-1.5.22.tar.gz
</a>
</ul>
<P>
These libraries (either static or dynamic) and their
interface header files must already be on your system.
It's OK if you install your own copies of these packages,
though you may need to tell make or configure where to find them.
Run "configure --help" for details.
<P>
On most Linux distributions these packages are already installed
or installable from packages included in the distribution.
You might need to install some -devel packages to get the include
header files.
                                                                                
<h2>Abbreviated Build Instructions (GNU tools)</h2>

<p>If you are using GNU tools, the recommended method for building
graphviz is the usual:
<pre>

	./configure
	make
	make install
</pre>

<p>If you are building from CVS sources, then you must have
recent versions of "libtool", "automake", and "autoconf".
Build with:
<pre>

	./autogen.sh
	./configure
	make
	make install
</pre>

<p>If you are not building with GNU tools, then there are some
tried-and-true old-style Makefiles that can be used instead.
Details below.

<h2>Detailed Build Instructions</h2>

<P>
There are a handful of preprocessor defines that control the
image driver configuration.  These preprocessor defines need to
agree with the libraries used in the Makefile.
<p>
The generic raster driver is <tt>gd</tt> and it can be configured to
generate GIF (no compression), PNG (lossless compression), JPEG
(lossy compression), and wireless bitmap (WBMP) files.
The compressors all need <tt>zlib</tt>.  In the current build we
have a top-level config.h file that defines various symbols, such as:
<P>
	HAVE_JPEG<br>
	HAVE_PNG<br>
<P>
If you don't enable the <tt>gd</tt> based drivers, graphviz will
still have the <tt>printf</tt> style drivers for Postscript and SVG.
(However, even these benefit from better text size estimation via
Freetype, when it is available.)
<P>
<h2>Build tools for Unix</h2>
You have several choices.
<P>
1. (Recommended for Linux) Use configure generated by GNU autoconf.
This often works well on a vanilla Linux distribution with
Tcl/Tk, freetype-devel and libjpeg already installed by root
under /usr.  Probably works OK with Solaris, too.
Otherwise some adjusting of command line arguments
to <tt>configure</tt> will be needed.
For Linux you can also just pick up the source tarball
or RPMs <A HREF="http://www.graphviz.org/pub/graphviz/">here</A>.
<P>
First, if you are using sources from CVS, run "./autogen.sh"
to generate the "configure" script.  If you are using sources
from graphviz-&lt;version&gt;.tar.gz this autogen.sh step should not be
needed.
<p>
Next, run configure. For help on possible configure options, run:
<br>
<pre>
./configure --help
</pre>
<p>
For example, I use <br>
<pre>
./configure  --prefix=$HOME/arch/sgi.mips3 \
	--with-freetypeincludedir=$HOME/arch/$ARCH/include/freetype2 \
	--with-freetypelibdir=$HOME/arch/$ARCH/lib \
	--with-tcl=/usr/common/tcl8.3.3 </pre>
<P>
Obviously you would change the pathnames to reflect your installation.
<p>
Note that the directory ${prefix}/include is automatically searched
for headers, and ${prefix}/lib for libraries.
<P>
If you have problems with one or more of the optional script language bindings,
they can be disabled with e.g. --disable-perl.
<p>
2. (Recommend for other Unix platforms.) As above, you need
the external packages to be installed somewhere.
<ul>
<li>
Run configure.old from the root graphviz directory.
<li>
Edit Config.mk for your architecture, tools, and installation directory.
In particular, set the ARCH make variable.
<li>
If desired, check settings in makearch/$(ARCH).
See below for further notes on individual platforms.
<li>
Run make.
</ul>
<pre>
make
make install
make clean
</pre>
	
<P>
3. (Recommended for Dave Korn and Eleftheris Koutsofios) Use AT&amp;T/Lucent
<A HREF="http://www.research.att.com/sw/tools/reuse/packages/astkit.html">nmake</A>.
<P>
You have to install the AST tools first.
<P>
Then edit Makeargs in the top source directory appropriately
and <tt>nmake install</tt>.  Some fiddling with X11 libs is probably
necessary to compile 'lefty'.  This usually involes editing
$INSTALLROOT/lib/lib/Xt or X11 (or less portably, edit nmakefile).
You may also need...
<pre>
export PACKAGE_tcl=/where/tcl/is/installed
</pre>
<P>
When nmake works, it's absolutely great, but it's usually
some work to get the environment right including the
actions of tools like <tt>iffe</tt> (the AST equivalent
of what GNU <tt>configure</tt> does).  If you're Lefty
or Dave Korn, you already knew that.
<P>
<h2>Build tools for win32</h2>
<p>See separate
<A HREF="http://www.graphviz.org/pub/scm/graphviz2/doc/winbuild.html">
build notes</A> for Microsoft Windows (in native mode).
<p>
With some persistence you can likely get Graphviz to build on
<A HREF="http://www.research.att.com/sw/tools/uwin">UWIN</A>
or <A HREF="http://www.cygwin.com/">Cygwin</A> installed on
Microsoft Windows.  You will still need various third-party packages
to enable all the Graphviz drivers.

<!--------------------------------------------------------------------------
Currently we build graphviz on Windows using the MS Visual C++ compiler only.
The project and makefiles can be found in both the CVS tree and the source
distribution package in the $ROOT/windows directory. ($ROOT refers
to the directory where the source tree has been installed.)
<p>
Follow the step-by-step procedure given below:
<p>
<ol>
<li>Open the WSH script file $ROOT/windows/winmake.wsf using a text editor
and set the "vc" variable to the location of MS VC++ on your machine.</li>
<p>
<li>Download the third-party libraries/header files from
<a href=http://www.research.att.com/sw/tools/graphviz/dist/third-party.zip>http:
//www.research.att.com/sw/tools/graphviz/dist/third-party.zip</a>.
Unzip the file in $ROOT directory.</li>
<p>
<li>Execute the $ROOT/windows/winmake.wsf file by double-clicking on the
file within Windows Explorer.</li>
<p>
<li>If the script throws errors, you'll need to open the graphviz project in
$ROOT/makearch/win32/static/graphviz.dsw using the MS Visual Studio.
Switch to the "File View" within the MS Visual Studio and trigger project
builds individually.</li>
<p>
<li>Follow step 4 for building tools in
$ROOT/makearch/win32/static/tools.dsw.</li>
</ol>

<P>
If you're ambitious, we have also used nmake from
<A HREF="http://www.research.att.com/sw/tools/uwin">
AT&amp;T UWIN</A> to build for both the UWIN environment
and the native win32 platform.
<pre>
	export nativepp=-1 <br>
	nmake CC=ncc  MSWIN32==1
</pre>
(the nativepp thing seems fixed in UWIN 2.25).
<p>
Obviously you need to have native versions
of zlib, libpng, jpeg and freetype. (See step 2 above. Or build them
yourself; see notes below.)
<P>
If you're running UWIN, of course, you can always just go
with either the old binaries of graphviz for UWIN
(from Dave Korn's <A HREF="http://www.research.att.com/sw/tools/uwin">UWIN
site </A>) or build graphviz as a UWIN program using nmake or gmake.
<br>
<P>
More win32 notes...
<il>
<P>
<li>
Add extra fluff to globals.h to pull in astwin32.h but #undef _UWIN
when compiling with CC=ncc.
</li>
<P>
<li>
MSVC 5.0 C compiler may die when -O is invoked on neato/splines.c;
this required nmakefile CC.NOOPTIMIZE.
</li>
<P>
<li>
Get cygwin versions of: zlib, png, jpeg-6b (required minor
source mods), freetype.1.3.1.
</li>
<P>
<li>
Build zlib by <tt>configure CC=ncc --prefix=/home/users/north/src/usr</tt>
then <tt>gmake install</tt>
</li>
<P>
<li>
Build png by copying scripts/makefile.gcc to makefile and editing slightly
then gmake install
</li>
<P>
<li>
Build jpeg same as zlib: <tt> gmake install-lib install-headers </tt>
</li>
<P>
<li>
Needed to hand-craft a lib/lib/z to go with our libz.a in order
to not unintentionally pull in /usr/lib/ast.lib (because of mistakenly
binding the lib/lib/z that goes with /usr/lib/z.lib).
</li>
<P>
<li>
----------------------------------------------------------->
We haven't tried to build tcldot or webdot in win32.
</li>
<h2>Unix platform-specific build notes</h2>
<h2>AIX</h2>
Matt Fago tells us that "--enable-shared=no" is required or the
executables segfault after seemingly correct compiles.  (Bug #421)
<h2>SGI</h2>
The default Irix libjpeg is obsolescent.  We need at least
version 62.  It wasn't at all clear to me where to get sources for
this - eventually I found the source for v61 and patches for v62
using a search engine.  We may eventually remove JPEG support
(lossy compression seems good for photos, not technical diagrams)
so if you can't get this to work, the loss of -Tjpeg is no big deal.
<P>

We found that on some platforms (Solaris?)
gd/dotneato and freetype MUST be compiled with the 
same C compiler (e.g. gcc, or the native cc).
Otherwise there are are weird stack argument errors in
the call to TT_Open_Face.  I don't have time to try
to figure out what's wrong.

<h2>Solaris</h2>
Put /usr/ccs/bin in PATH

<h2>HP-UX</h2>
The X11 package must include /usr/contrib/X11R6
as well as the base stuff.  For some reason GNU autoconf doesn't seem to find
X11 in this location so you may need to add the following to the
./configure line:
<pre>
--with-Xawincludedir=/usr/contrib/X11R6/include --with-Xawlibdir=/usr/contrib/X11R6/lib
</pre>

<h2>Apple Mac OS/X</h2>
<P>
Currently, PixelGlow (Glen Low) provides a full featured
<A HREF="http://www.pixelglow.com/graphviz/">
port of Graphviz</A> including a very nice Aqua-based graph
document container.  Highly recommended. We merged his patches
into our source, but we don't build or test on OS X. Talk to Glen.
<P>
The following are old pre-Pixelglow build notes:
<P>
dot and neato build with old make.  (Didn't bother with tcldot.)
<P>
There could still be problems with case-sensitive names,
though we fixed all the ones we could find.
<P>
It's weird that Mac OSX declares lrand48() but it's not
defined in any of the standard system library functions.

<h2>GNU style building</h2>

<pre>
<!--
To produce graphviz-(ver).tar.gz from CVS sources.

	cvs checkout graphviz
	cd graphviz
	./autogen.sh
	make dist
-->
To produce graphviz-(ver).tar.gz from GIT sources using cogito.
	cg clone http://www.graphviz.org/pub/scm/graphviz2/.git
	cd graphviz2
or to update from GIT
	cd graphviz2
	cg update
then
	./autogen.sh
	make dist

(Cogito &amp; GIT are available from http://www.kernel.org/pub/software/scm/
or as binary packages in Fedora-Extras )

To build source and binary rpms (results are left in /usr/src/redhat/ ):

	rpm -ta graphviz-(ver).tar.gz

To build locally:

	zcat graphviz-(ver).tar.gz | tar xfvo -
	cd graphviz-(ver)
	./configure
	make
	make install
</pre>

</body>
</html>
